home *** CD-ROM | disk | FTP | other *** search
- /*
- File: FW_CPrivFWFWNode.h
-
- Contains: Tree node class
-
- Written by: Richard Rodseth
-
- Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <1> 10/24/94 jpa first checked in
- <3> 6/9/94 RR Remove ASLM stuff
- <1> 5/5/94 CG first checked in
- <6> 3/15/94 MB Changes to support SCpp/ASLM builds,
- #1150864.
- <5> 2/7/94 JA Tiger Team Makeover!
- <4> 10/18/93 CG Added #define id for ASLM
- <3> 9/3/93 JBS added SkipChildren()
- <2> 7/21/93 NP Added desctructor to FW_CPrivNode.
- <1> 1/26/93 RCR first checked in
-
- To Do:
- */
-
- #ifndef FWNODE_H
- #define FWNODE_H
-
- #ifndef FWLIST_H
- #include "FWList.h"
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //=====================================================================================
- // Classes defined in this interface
- //=====================================================================================
-
- class FW_CLASS_ATTR FW_CPrivNode;
- class FW_CLASS_ATTR FW_CPrivNodeTraverser;
-
- //=====================================================================================
- // Classes used by this interface
- //=====================================================================================
-
- class FW_CLASS_ATTR FW_CPrivLink;
- class FW_CLASS_ATTR FW_CPrivLinkedList;
-
- //=====================================================================================
- // Typedefs and defines
- //=====================================================================================
-
- typedef unsigned long FW_TraversalType;
- #define FW_kTopDown 1UL
- #define FW_kBottomUp 2UL
- #define FW_kChildrenOnly 3UL
-
- typedef unsigned long FW_SiblingOrder;
- #define FW_kFrontToBack 1UL
- #define FW_kBackToFront 2UL
-
- #ifdef GetFirstChild
- #undef GetFirstChild // WindowsX.h macro
- #endif
-
- #ifdef GetNextSibling
- #undef GetNextSibling // WindowsX.h macro
- #endif
-
- //=====================================================================================
- // Class FW_CPrivNode
- //=====================================================================================
-
- class FW_CLASS_ATTR FW_CPrivNode : private FW_CPrivLink, private FW_CPrivLinkedList
- {
- public:
- FW_CPrivNode();
- ~FW_CPrivNode();
-
- unsigned long Size();
-
- FW_CPrivNode* GetParent();
- FW_CPrivNode* GetFirstChild();
- FW_CPrivNode* GetLastChild();
- FW_CPrivNode* GetNextSibling();
- FW_CPrivNode* GetPreviousSibling();
-
- void SetParent(FW_CPrivNode* parent);
-
- void AddChildFirst(FW_CPrivNode* node);
- void AddChildLast(FW_CPrivNode* node);
- void AddChildBefore(FW_CPrivNode& existing, FW_CPrivNode* node);
- void AddChildAfter(FW_CPrivNode& existing, FW_CPrivNode* node);
- void RemoveChild(FW_CPrivNode& node);
- FW_CPrivNode* GetChildAfter(FW_CPrivNode* node);
- FW_CPrivNode* GetChildBefore(FW_CPrivNode* node);
-
- FW_CPrivNode* FirstTopDown();
- FW_CPrivNode* NextTopDown(FW_SiblingOrder siblingOrder);
- FW_CPrivNode* GetNextAunt(FW_SiblingOrder siblingOrder);
-
- FW_CPrivNode* FirstBottomUp(FW_SiblingOrder siblingOrder);
- FW_CPrivNode* NextBottomUp(FW_SiblingOrder siblingOrder);
-
- private:
- FW_CPrivNode* fParent;
- };
-
- //=====================================================================================
- // Class FW_CPrivNodeTraverser
- //=====================================================================================
-
-
- class FW_CLASS_ATTR FW_CPrivNodeTraverser
- {
- public:
-
- FW_CPrivNodeTraverser(FW_CPrivNode* root,
- FW_TraversalType traversalType,
- FW_SiblingOrder siblingOrder);
- ~FW_CPrivNodeTraverser();
-
- FW_CPrivNode* First();
- FW_CPrivNode* Next();
- void SkipChildren();
- FW_Boolean IsNotComplete();
-
- protected:
-
- FW_CPrivNode* FirstTopDown(FW_CPrivNode* node);
- FW_CPrivNode* NextTopDown(FW_CPrivNode* node, FW_SiblingOrder siblingOrder);
- FW_CPrivNode* GetNextAunt(FW_CPrivNode* node, FW_SiblingOrder siblingOrder);
- FW_CPrivNode* FirstBottomUp(FW_CPrivNode* node, FW_SiblingOrder siblingOrder);
- FW_CPrivNode* NextBottomUp(FW_CPrivNode* node, FW_SiblingOrder siblingOrder);
-
- private:
- FW_CPrivNode* fRoot;
- FW_CPrivNode* fCurrent;
- FW_TraversalType fTraversalType;
- FW_SiblingOrder fSiblingOrder;
- };
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif // FWNODE_H
-